<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>个人中心</title>
    <style>
        body, html {
            height: 100%;
            margin: 0;
            font-family: Arial, sans-serif;
        }

        .sidebar {
            width: 90px;
            background-color: #333;
            color: white;
            padding: 15px;
            position: fixed;
            top: 0;
            left: 0;
            height: 100%;
        }

        .sidebar h2 {
            padding: 10px;
            color: #fff;
        }

        .sidebar ul {
            list-style-type: none;
            padding: 0;
        }

        .sidebar ul li a {
            color: white;
            padding: 10px;
            display: block;
            text-decoration: none;
        }

        .sidebar ul li a:hover {
            background-color: #575757;
        }

        .sidebar ul li a.active {
            background-color: #4CAF50;
        }

        .main-content {
            margin-left: 120px;
            padding: 20px;
        }

        .header {
            background-color: #333;
            color: white;
            text-align: center;
            padding: 10px 0;
        }

        .content {
            padding: 20px;
        }

        .info-block {
            width: 400px;
            margin: 0 auto;
            line-height: 2;
        }

        .info-block label {
            font-weight: bold;
        }

        .info-block p {
            margin: 0 0 10px 0;
        }

        form {
            text-align: center;
            margin-top: 30px;
        }

        input[type="submit"] {
            background-color: #4CAF50;
            color: white;
            padding: 10px 15px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }

        input[type="submit"]:hover {
            background-color: #45a049;
        }
    </style>
</head>
<body>
<div class="sidebar">
    <h2>菜单</h2>
    <ul>
        <li><a href="${pageContext.request.contextPath}/application/bookList.jsp" class="<%= request.getRequestURI().endsWith("bookList.jsp")? "active" : "" %>">图书列表</a></li>
        <li><a href="${pageContext.request.contextPath}/application/addBook.jsp" class="<%= request.getRequestURI().endsWith("addBook.jsp")? "active" : "" %>">添加图书</a></li>
        <li><a href="${pageContext.request.contextPath}/application/borrowRecord.jsp" class="<%= request.getRequestURI().endsWith("borrowRecord.jsp")? "active" : "" %>">借阅记录</a></li>
        <li><a href="${pageContext.request.contextPath}/application/readerList.jsp" class="<%= request.getRequestURI().endsWith("readerList.jsp")? "active" : "" %>">读者列表</a></li>
        <li><a href="${pageContext.request.contextPath}/application/PersonalData.jsp" class="<%= request.getRequestURI().endsWith("PersonalData.jsp")? "active" : "" %>">个人中心</a></li>
        <li><a href="${pageContext.request.contextPath}/login.jsp">退出登录</a></li>
    </ul>
</div>
<div class="main-content">
    <div class="header">
        <a>图书信息管理系统 - 个人中心</a>
    </div>
    <div class="content">
        <h2>个人信息</h2>
        <div class="info-block">
            <c:choose>
                <c:when test="${not empty reader}">
                    <p><label>姓名：</label>${reader.name}</p>
                    <p><label>性别：</label>${reader.gender}</p>
                    <p><label>年龄：</label>${reader.age}</p>
                    <p><label>联系方式：</label>${reader.contact_info}</p>
                    <p><label>证件类型：</label>${reader.id_type}</p>
                    <p><label>证件号码：</label>${reader.id_number}</p>
                    <p><label>借阅上限：</label>${reader.borrow_limit}</p>
                    <p><label>借阅期限：</label>${reader.borrow_period}</p>
                    <p><label>是否可续借：</label>
                        <c:choose>
                            <c:when test="${reader.can_renew}">是</c:when>
                            <c:otherwise>否</c:otherwise>
                        </c:choose>
                    </p>
                    <p><label>角色：</label>${reader.role}</p>
                </c:when>
                <c:otherwise>
                    <p>未找到个人信息。</p>
                </c:otherwise>
            </c:choose>
        </div>

        <form action="${pageContext.request.contextPath}/personalData" method="get">
            <input type="hidden" name="action" value="edit"/>
            <input type="submit" value="修改资料"/>
        </form>
    </div>
</div>


